<template>
	<view class="publish_wrap">
		<block v-if="list.length > 0">
			<view class="list_wrap" v-for="(item,index) in list">
				<view class="flex-col list-item" @click="toActivity(item.activity.id)">
					<view class="flex-row">
						<image class="shrink-0 image_8" :src="ossUrl + item.activity.image" />
						<view class="flex-col flex-1 group_5 ml-10">
							<text class="font_2 row_2">{{ item.activity.title }}</text>
							<view class="font_3 text_2 mt-2">活动时间：{{ item.activity.start_time }}</view>
							<text class="mt-6 font_3 text_2">活动地址：{{ item.activity.address }}</text>
						</view>
					</view>
				</view>
			</view>
		</block>
		<view v-else style="text-align: center;padding-top: 130rpx;">暂无报名~</view>
	</view>
</template>

<script>
	import {
		ossUrl
	} from '@/utils/config.js'
	import {
		myActivity
	} from '@/api/forum.js'
	export default {
		data() {
			return {
				ossUrl: ossUrl,
				list: []
			};
		},
		onLoad() {
			this.getActivityFun()
		},
		onShareAppMessage(res) { //发送给朋友
			return {
				title: '小程序分享',
				imageUrl: '',
			}
		},
		methods: {
			getActivityFun() {
				myActivity().then(res => {
					if (res.code == 1) {
						this.list = res.data
					}
				})
			},
			toActivity(id) {
				uni.navigateTo({
					url: '../activity_detail/activity_detail?id=' + id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.publish_wrap {
	min-height: 100vh;
	background: #f5f5f5;
	padding-top: 20rpx;
	padding-bottom: 20rpx;
	.list_wrap {
		margin-bottom: 20rpx;
	
		.list-item {
			width: 690rpx;
			margin: 0 auto;
			padding: 24rpx 24rpx 16rpx;
			background-color: #ffffff;
			border-radius: 10rpx;
	
			.image_8 {
				border-radius: 10rpx;
				width: 240rpx;
				height: 180rpx;
			}
	
			.group_5 {
				margin-right: 4rpx;
	
				.font_2 {
					height: 80rpx;
					font-weight: bold;
					font-size: 28rpx;
					color: #000000;
				}
	
				.font_3 {
					font-size: 22rpx;
					color: #000000;
				}
			}
	
			.font_4 {
				font-size: 22rpx;
				color: #000000;
			}
	
			.text_2 {
				opacity: 0.5;
			}
	
			.button {
				padding: 5rpx 10rpx;
				background-color: #1c41f1;
				border-radius: 8rpx;
	
				.font_5 {
					font-size: 24rpx;
					color: #ffffff;
				}
			}
			.button_1 {
				padding: 5rpx 10rpx;
				background-color: #70D042;
				border-radius: 8rpx;
			
				.font_5 {
					font-size: 24rpx;
					color: #ffffff;
				}
			}
			.button_2 {
				padding: 5rpx 10rpx;
				background-color: #808080;
				border-radius: 8rpx;
			
				.font_5 {
					font-size: 24rpx;
					color: #ffffff;
				}
			}
		}
	}
}
</style>
